<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp"%>
<!DOCTYPE html>
<html>
<head>
	<title><spring:message code="message.lable.ShouHuoMingXi"/></title>
	<%@ include file="/WEB-INF/component/commonCSS.jsp"%>
    <!--[if lt IE 9]>
        <script src="lib/js/html5shiv.min.js"></script>
        <script src="lib/js/respond.min.js"></script>
    <![endif]-->
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
        <h1>到货汇总</h1>
        <ol class="breadcrumb">
        	<li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i><spring:message code="message.lable.first"/></a></li>
        	<li><a href="#">交易</a></li>
            <li><a href="#"><spring:message code="message.list.DingDanGuanLi"/></a></li>
            <li><a href="#"><spring:message code="message.list.ShouHuoRuKu"/></a></li>
            <li class="active"><a href="#">到货汇总</a></li>
        </ol>
    </section>
    
 <section class="content">
        <div class="box box-success">
            <div class="box-body">
                 <div class="input">
                	<div class="textalign1"><spring:message code="message.listForm.tongYongMing"/><spring:message code="message.yanZheng.maoHao"/></div>
	                    <div class="boxinput">
	                    <input type="text" class="textinput" id="drugName"	name="drugName" placeholder="<spring:message code="message.listForm.tongYongMing"/>/<spring:message code="message.listForm.pinYinMa"/>" />
	                    </div>
                	<%--<div class="textalign"><spring:message code="message.listForm.yaoPinBianMa"/><spring:message code="message.yanZheng.maoHao"/></div>
	                    <div class="boxinput">
	                    <input type="text" class="textinput" id="drugCode"	name="drugCode" placeholder="<spring:message code="message.listForm.yaoPinBianMa"/>" />
	                    </div>--%>
	                <div class="textalign"><spring:message code="message.listForm.shengChanQiYe"/><spring:message code="message.yanZheng.maoHao"/></div>
	                    <div class="boxinput">
	                    <input type="text" class="textinput" id="compName"	name="compName" placeholder="<spring:message code="message.listForm.shengChanQiYe"/>/<spring:message code="message.listForm.pinYinMa"/>" />
	                    </div>
						<div class="textalign"><spring:message code="message.listForm.PeiSongQiYe"/><spring:message code="message.yanZheng.maoHao"/></div>
	                    <div class="boxinput">
	                    <input type="text" class="textinput" id="delCompName"	name="delCompName" placeholder="<spring:message code="message.listForm.PeiSongQiYe"/>/<spring:message code="message.listForm.pinYinMa"/>" />
	                    </div>
					    <button type="button" onclick="gridSerch();" class="btn btn-success btn-sm" id="selectDicCompType"><spring:message code="message.button.seachSpacing"/></button>
	                </div>
					
                </div>
                </div>
            </div>


        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
        <!-- <div class=" box box-warning bottongroup">
        </div> -->
    </section>
    <%@ include file="/WEB-INF/component/commonJS.jsp"%>
    <script type="text/javascript">
  //绑定回车
    $('#drugName,#drugCode,#compName,#delCompName').bind('keydown', function(event) {
        if (event.keyCode == "13") {
            $('#selectDicCompType').click();
        }
    });	
    $("#drugName").focus();//加载页面光标在第一个查询框内
    
    
    
    
        $(function () {
            
            $("#gridlist").jqGrid({
            	  url: "${ctx}/purOrderInfo/getArrivedDrug.html?userId=${param.userId}",
                  mtype: "POST",
                  datatype: "json",
                  autowidth: true,
                  shrinkToFit: false,
                 // height: 325,
	              colNames: [
	                         'delCompId',
	                         'drugId',
	                         'userId',
	                         'userName',
	                         '<spring:message code="message.listForm.PeiSongQiYe"/>',
	                         '<spring:message code="message.listForm.yaoPinBianMa"/>',
		                     '<spring:message code="message.listForm.tongYongMing"/>', 
		                     '<spring:message code="message.listForm.jiXing"/>',
		                     '<spring:message code="message.listForm.guiGe"/>',
		                     '<spring:message code="message.listForm.zhuanHuanXiShu"/>',
		                     '<spring:message code="message.listForm.baoZhuangDanWei"/>', 
		                     '<spring:message code="message.listForm.caiZhi"/>',
		                     '<spring:message code="message.listForm.shengChanQiYe"/>',
		                     '国药准字',
	                         '<spring:message code="message.listForm.shangBianMa"/>',
	                         '已退货数量',
	                         '<spring:message code="message.listForm.PiCiHao"/>',
                             '<spring:message code="message.listForm.DaoHuoShuLiang"/>',
                             '有效期',
                             '<spring:message code="message.listForm.CaiGouJia"/>'
	                         ],
	              colModel: [
					{ name: 'delCompId', index: 'ship',hidden:true, width: 80, align: "center", sortable:false },
					{ name: 'drugId', index: 'ship', hidden:true, width: 80, align: "center", sortable:false },
					{ name: 'userId', index: 'ship', hidden:true, width: 80, align: "center", sortable:false },
					{ name: 'userName', index: 'ship', hidden:true, width: 80, align: "center", sortable:false },
					{ name: 'delCompName', index: 'ship', width: 136, align: "left", sortable:false/* ,
						 formatter:function(cellvalue, options,row) {
							 return "<a href=\"javascript:showCompInfo('"+row.delCompId+"')\">"+cellvalue+"</a>"
			     		} */ 
                    },
					{ name: 'drugCode', index: 'sdate', hidden:true,width: 100, align: "center", sortable:false/* ,
						formatter:function(cellvalue, options, row) {
							return "<a href=\"javascript:showDrugInfo('"+cellvalue+"')\">"+cellvalue+"</a>"
                    	} */
                    },
					{ name: 'drugName', index: 'name', width: 168,align:"left", sortable:false },
                    { name: 'formName', index: 'stock', width: 75 , align: "center", sortable:false },
                    { name: 'specName', index: 'ship', width: 179, align: "left", sortable:false  },
                    { name: 'factor', index: 'ship', width: 80, align: "center", sortable:false },
                    { name: 'unit', index: 'ship', width: 60, align: "center", sortable:false },
                    { name: 'materialName', index: 'ship', hidden:true,width: 80, align: "center", sortable:false },
                    { name: 'compName', index: 'ship', width: 180, align: "left" ,  sortable:false /* ,
                    	formatter:function(cellvalue, options,row) {
                    		return "<a href=\"javascript:showCompInfo('"+row.compId+"')\">"+cellvalue+"</a>"
      		     		} */
                    },
                	{ name: 'drugMedicine', index: 'drugMedicine',width: 100, align: "center", sortable:false},
                    { name: 'goodsCode', index: 'sdate',hidden:true, width: 100, align: "center", sortable:false},
                    { name: 'returnCount', index: 'sdate', width: 100, align: "right", sortable:false},
                    { name: 'approveCode', index: 'sdate', width: 95, align: "center", sortable:false},//批号
                    { name: 'totalAmount', index: 'sdate', width: 80, align: "center", sortable:false},//到货明细表中到货数量
                    { name: 'credential', index: 'ship', width: 156, align: "center", sortable:false },
                    { name: 'proPrice', index: 'ship', width: 80, align: "right", sortable:false ,
                       formatter:function(cellvalue, options, row){
                           return formatAmount(cellvalue, options, row);
                       }
                    }
                    
                ],
                rowNum: 20,
                rowList: [10, 20, 50, 100],
                rownumbers: true,
                pager: "#gridpage",
                //multiselect: true, 
                viewrecords: true,
                gridComplete:function(){
                	//序号列宽度自适应（参数为jqgridID）
                    autoRNWidth("gridlist");
                	//数据只有一条时默认选中（参数为jqgridID）
                    selectByOneData("gridlist");
                },
                caption: "到货汇总信息列表",
                jsonReader: {
                    repeatitems: false,
                    id: "ids"
                }
            });
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            $(window).trigger("resize");
            $("#gridlist").jqGrid("setGridHeight", create());
        });
        
        
        
        
        function gridSerch() {
        	var drugCode = $.trim($("#drugCode").val());
        	var drugName = $.trim($("#drugName").val());
        	var compName = $.trim($("#compName").val());
        	var delCompName = $.trim($("#delCompName").val());
    		$("#gridlist").jqGrid('setGridParam',{  
    	        datatype:'json',
    	        postData:{
    	        		"drugCode":drugCode,
    	        		"drugName":drugName,
    	        		"compName":compName,
    	        		"delCompName":delCompName},
    	        		page:1
    	    }).trigger("reloadGrid"); //重新载入  
    	}
        	
        	
        
        
        
    </script>
</body>
</html>